package com.study.design.pattern.pattern.structural.proxy.cglibproxy;

/**
 * @Author: gongsl
 * @Date: 2025-03-19 22:11
 */
public class DynamicProxyWithCGLIBTest {
    public static void main(String[] args) {
        // 创建目标对象
        PaymentService paymentService = new PaymentServiceImpl();
        // 创建CGLIB代理对象
        PaymentServiceCGLIBProxy proxy = new PaymentServiceCGLIBProxy(paymentService);
        PaymentService proxyPaymentService = (PaymentService) proxy.getProxy();
        // 通过代理对象调用方法
        proxyPaymentService.pay("1000");
    }
}
